(function () {
    "use strict";
    angular.module("cmss.filter", [])
        //文件大小
        .filter("sizeFilter", [
            function () {
                return function (input) {
                    var size="";
                    if(input == null || input == 0 || input == undefined){
                        size = "0.00B";
                    } else if(input > 0 && input < 1000){
                        size = input +"B";
                    } else if(input >=1000 && input < 1000 * 1024) {
                        size = (input / 1000).toFixed(2) + "KB";
                    } else if(input >= 1000 * 1024 && input < 1000*1024*1024){
                        size = (input / (1000 * 1024)).toFixed(2) + "MB";
                    } else if(input >= 1000 * 1024 * 1024 && input < 1000*1024*1024*1024){
                        size = (input / (1000 * 1024 * 1024)).toFixed(2) + "GB";
                    } else {
                        size = (input / (1000 * 1024 * 1024 * 1024)).toFixed(2) + "TB";
                    }
                    return size;
                };
            }
        ])
        .filter("AcceptanceType", [
            function () {
                return function (input) {
                    var result = "";
                    switch (input){
                        case "REQUIREMENT_DOCUMENT":
                            result = "需求文档";
                            break;
                        case "USER_INSTRUCTION_MANUAL":
                            result = "用户使用手册";
                            break;
                        case "FRAMEWORK_DOCUMENT":
                            result = "框架文档";
                            break;
                        case "INSTALL_DEPLOY_MANUAL":
                            result = "安装部署手册";
                            break;
                        case "ADMIN_INSTRUCTION_MANUAL":
                            result = "管理员使用手册";
                            break;
                        case "RELEASE_NOTE":
                            result = "发布说明";
                            break;
                        default:
                            break;
                    }
                    return result;
                };
            }
        ])
        .filter("AcceptanceStatusType", [
            function () {
                return function (input) {
                    var result = "";
                    switch (input){
                        case true:
                            result = "是";
                            break;
                        case false:
                            result = "否";
                            break;
                        default:
                            result = "否";
                            break;
                    }
                    return result;
                };
            }
        ])
    ;
})();
